package com.cjk.service.Impl;

import com.cjk.mapper.EmpMapper;
import com.cjk.pojo.JobOption;
import com.cjk.service.ReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class ReportServiceImpl implements ReportService {

    @Autowired
    private EmpMapper empMapper;
    /**
     * 获取员工职位数据
     * @return
     */
    @Override
    public JobOption JobOption() {

        List<Map<String, Object>> jobOption= empMapper.JobOption();
        List<Object> jobList = jobOption.stream().map(dataMap -> dataMap.get("pos")).toList();
        List<Object> dataList = jobOption.stream().map(dataMap -> dataMap.get("total")).toList();
        return new JobOption(jobList, dataList);
    }

    /**
     * 获取员工性别数据
     * @return
     */
    @Override
    public List<Map<String, Object>> GenderOption() {
        return empMapper.GenderOption();
    }
}
